package com.lcj.aoch.rule.controller.form;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@Data
@Schema(description = "计算代驾费用的表单")
public class CalculateOrderChargeForm {
  @NotNull(message = "minute不能为空")
  @Min(value = 0L, message = "minute不能小于1")
  @Schema(description = "等时分钟")
  private Integer minute;
  
  @NotBlank(message = "time不能为空")
  @Pattern(regexp = "^(20|21|22|23|[0-1]\\d):[0-5]\\d:[0-5]\\d$", message = "time内容不正确")
  @Schema(description = "行程开始时间")
  private String time;
  
  @NotBlank(message = "mileage不能为空")
  @Pattern(regexp = "^[1-9]\\d*\\.\\d+$|^0\\.\\d+$|^[1-9]\\d*$", message = "mileage内容不正确")
  @Schema(description = "代驾公里数")
  private String mileage;
  
  public CalculateOrderChargeForm(Integer minute, String time, String mileage) {
    this.minute = minute;
    this.time = time;
    this.mileage = mileage;
  }
  
  public CalculateOrderChargeForm() {}

  @Override
  public boolean equals(Object o) {
    if (o == this)
      return true; 
    if (!(o instanceof CalculateOrderChargeForm))
      return false; 
    CalculateOrderChargeForm other = (CalculateOrderChargeForm)o;
    Object this$minute = getMinute(), other$minute = other.getMinute();
    if ((this$minute == null) ? (other$minute != null) : !this$minute.equals(other$minute))
      return false; 
    Object this$time = getTime(), other$time = other.getTime();
    if ((this$time == null) ? (other$time != null) : !this$time.equals(other$time))
      return false; 
    Object this$mileage = getMileage(), other$mileage = other.getMileage();
    return !((this$mileage == null) ? (other$mileage != null) : !this$mileage.equals(other$mileage));
  }
  
  public int hashCode() {
    int PRIME = 59;
    int result = 1;
    Object $minute = getMinute();
    result = result * 59 + (($minute == null) ? 43 : $minute.hashCode());
    Object $time = getTime();
    result = result * 59 + (($time == null) ? 43 : $time.hashCode());
    Object $mileage = getMileage();
    return result * 59 + (($mileage == null) ? 43 : $mileage.hashCode());
  }

}
